package com.biz.primus.ms.promotion.degrad;

import com.biz.primus.base.vo.promotion.PromotionProductVo;
import com.biz.primus.ms.promotion.feign.ProductFeignClient;
import com.biz.primus.product.vo.SecProductInfoReqVo;
import com.biz.primus.product.vo.SecProductInfoRespVo;
import com.google.common.collect.Lists;
import java.util.Collections;
import java.util.List;
import org.apache.commons.collections.CollectionUtils;
import org.springframework.stereotype.Component;

/**
 * @author david-liu
 */
@Component
public class ProductFeignClientDegraded implements ProductFeignClient {
    @Override
    public List<SecProductInfoRespVo> secProductInfo(SecProductInfoReqVo secProductInfoReqVo) {
        return null;
    }

    @Override
    public SecProductInfoRespVo secProductInfo(Long productId) {
        return null;
    }

    @Override
    public List<PromotionProductVo> getPromotionProducts(List<Long> productIds) {
        // TODO 暂时返回Mock数据
        if (CollectionUtils.isEmpty(productIds)) {
            return Collections.emptyList();
        }

        List<PromotionProductVo> ret = Lists.newArrayList();
        for (Long productId : productIds) {
            PromotionProductVo vo = new PromotionProductVo();
            vo.setProductId(productId);
            vo.setProductCode("Code" + productId);
            vo.setProductName("Name" + productId);
            vo.setBrandId(productId);
            vo.setCategoryId(productId);
            vo.setBrandName("BrandName" + productId);
            vo.setCategoryName("CategoryName" + productId);
            ret.add(vo);
        }
        return ret;
    }
}
